/**
 * 郭楠project
 * com.gn.controller
 * ArticlePageController.java
 * 创建人:TonyGuo 
 * 时间：2017年3月23日-上午1:30:58 
 * 2017Tm公司-版权所有
 */
package com.gn.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.gn.entity.Article;
import com.gn.service.ArticleService;

/**
 * 
 * ArticlePageController
 * 创建人:TonyGuo
 * 时间：2017年3月23日-上午1:30:58 
 * @version 1.0.0
 * 
 */
@Controller
public class ArticlePageController {
	private final Logger logger = LoggerFactory.getLogger(MainController.class);
	
	@Resource
	ArticleService articleService;
	/**
	 * @param page-文章列表
	 * @return String
	 */
	@RequestMapping(value="/article_list.htm",method=RequestMethod.GET)
	public String articleList(HttpServletRequest req){
		
		return "article_list";
	}
	
	/**
	 * @param page-文章详情
	 * @param aid:文章aid
	 * @return String
	 */
	@RequestMapping(value="/article",method=RequestMethod.GET)
	public String articleDetail(HttpServletRequest req,String aid){
		Article article=null;
		if(aid!=null){
			article=articleService.get(aid);
			req.getSession().setAttribute("article", article);
		}
		return "article_detail";
	}
}
